// 专栏路由
const exporess = require('express')
const router = exporess.Router()
const columnHandler = require('../router_handler/columnHandler')
const expressJoi = require('@escook/express-joi')
const { list_column__schema, detail_column__schema, user_column__schema, update_column_schema, add_column_schema } = require('../schema/columnSchema')

// 获取专栏列表
router.get('/list/columns', expressJoi(list_column__schema), columnHandler.getColumnList)

// 获取所有专栏
router.get('/list/allColumns', columnHandler.getAllColumns)

// 新增专栏
router.post('/columns', expressJoi(add_column_schema), columnHandler.addColumn)

// 获取专栏详情
router.get('/columns/:id', expressJoi(detail_column__schema), columnHandler.getColumnDetail)

// 获取该用户拥有的专栏
router.get('/column/:userId', expressJoi(user_column__schema), columnHandler.getUserColumns)

// 更新专栏信息
router.patch('/columns', expressJoi(update_column_schema), columnHandler.updateColumnInfo)

module.exports = router